var list={} ;
var selecteDay;
function showRl() {
	var curTime = new Date().getFullYear() + "-" + (new Date().getMonth() + 1) + "-" + new Date().getDate();
	var url = 'http://api.sungohealth.com/healthy/year';
	var token = 'e4642a8b1e41f43138f3c3db6ccabf95';
	var dateArr = new Array();
	var myArr = new Array();
    home(curTime,vm.user.userId,vm.user.userId,token);
	$.ajax({
		type: 'POST',
		url: url,
		async: false,
		data: {
			userId: vm.user.userId,
			token: token,
			addTime: curTime,
			friendId: vm.user.userId,
			interfaceType: 'health'
		},
		dataType: 'json',
		success: function(response) {
			console.log(response);
			for(i = 0; i <= 11; i++) {
				if(response.data[i]['days'].length !== 0) {
					dateArr.push(response.data[i]);
				}
			}
		}
	})
	// 传递日期信息
	for(var d = 0; d < dateArr.length; d++) {
		for(var str of dateArr[d].days) {
			myArr.push(str)
		}
	}

	list = myArr;
    change();
	window.onload = function() {
		$('.calendar-date .item').on("click", function() {
             selecteDay = $(this).attr('data');
            vm.user.selecteDay =selecteDay
            home(selecteDay,vm.user.userId,vm.user.userId,token);
            $(".calendarBox").hide();
		});

	}
	$(document).on("click", ".dateBtn", function() {
		$(".calendarBox").show();
	})
    $(document).on("click", ".info_wh", function() {
        $(".calendarBox").hide();
    })

}

function home(addTime, userId, friendId, token) {
    fnWeb(addTime, userId, friendId, token)
    fnOrgans(addTime, userId, friendId, token)
    fnScore(addTime, userId, friendId, token)
    fnSleep(addTime, userId, friendId, token)
    fnSpirit(addTime, userId, friendId, token)
    fnSport(addTime, userId, friendId, token)
    }


